'use strict'
module.exports = (sequelize, DataTypes) => {
  return sequelize.define(
    'github_user',
    {
      id: { type: DataTypes.STRING(100), primaryKey: true, allowNull: false },
      login: { type: DataTypes.STRING, allowNull: false },
      avatar_url: { type: DataTypes.STRING, allowNull: false },
      gravatar_id: {
        type: DataTypes.STRING,
        allowNull: true,
        defaultValue: ''
      },
      url: { type: DataTypes.STRING, allowNull: false },
      html_url: { type: DataTypes.STRING, allowNull: false },
      followers_url: { type: DataTypes.STRING, allowNull: false },
      following_url: { type: DataTypes.STRING, allowNull: false },
      gists_url: { type: DataTypes.STRING, allowNull: false },
      starred_url: { type: DataTypes.STRING, allowNull: false },
      subscriptions_url: { type: DataTypes.STRING, allowNull: false },
      organizations_url: { type: DataTypes.STRING, allowNull: false },
      repos_url: { type: DataTypes.STRING, allowNull: false },
      events_url: { type: DataTypes.STRING, allowNull: false },
      received_events_url: { type: DataTypes.STRING, allowNull: false },
      type: { type: DataTypes.STRING, allowNull: false },
      site_admin: {
        type: DataTypes.BOOLEAN,
        allowNull: false,
        defaultValue: false
      },
      name: { type: DataTypes.STRING, allowNull: false, defaultValue: '' },
      company: { type: DataTypes.STRING, allowNull: false, defaultValue: '' },
      blog: { type: DataTypes.STRING, allowNull: true, defaultValue: '' },
      location: { type: DataTypes.STRING, allowNull: false, defaultValue: '' },
      email: { type: DataTypes.STRING, allowNull: false, defaultValue: '' },
      hireable: { type: DataTypes.STRING, allowNull: false, defaultValue: '' },
      bio: { type: DataTypes.STRING, allowNull: false, defaultValue: '' },
      public_repos: {
        type: DataTypes.INTEGER,
        allowNull: false,
        defaultValue: 0
      },
      public_gists: {
        type: DataTypes.INTEGER,
        allowNull: false,
        defaultValue: 0
      },
      followers: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0 },
      following: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0 },
      last_visit_time: {
        type: DataTypes.DATE,
        defaultValue: DataTypes.NOW,
        allowNull: false
      }
    }, {
      timestamps: true
    }
  )
}
